import {Injectable, OnInit} from "@angular/core";
import {HttpUtil, Result} from "@app/utils/http-util.service";
import {Observable} from "rxjs";
import {${TableName!}} from "../entity/${table\-name!}";

@Injectable({
  providedIn: 'root'
})
export class ${TableName!}Service implements OnInit {
  constructor(private http: HttpUtil) {
  }

  ngOnInit(): void {
  }



  public page(page: number, size: number, queryParam: ${TableName!} | any): Observable<Result> {
    return this.http.get("/api/${tableName!}/page", {
      page: page,
      size: size,
      ...queryParam
    })
  }

  public add(data: any): Observable<Result> {
    return this.http.post("/api/${tableName!}/baseAdd", data)
  }

  public update(data: any): Observable<Result> {
    return this.http.put("/api/${tableName!}/baseUpdate", data)
  }

  public list(): Observable<Result> {
    return this.http.get("/api/${tableName!}/baseList")
  }
  public remove(ids: string): Observable<Result> {
    return this.http.delete("/api/${tableName!}/baseRemove", {ids: ids})
  }
}
